
*********************************************
****   Description   ************************
*********************************************

*This program presents summary statistics of the loan-level database, generating Panel B of "Table 2. Deposit and Loan Datasets – Summary Statistics". 

*********************************************
****   Summary Stats - Loan Level ***********
*********************************************
use "$Data/Loan_Database_December2024.dta", clear


//Adjust Variables
replace washington = washington*100 
replace manager_mapped = manager_mapped*100 
gen white = (race == "white")*100
replace white = . if audited != "yes" 
gen contractor_re_developer = (occupation_cleaned == "contractor_re_developer")*100  
replace contractor_re_developer = . if audited != "yes" 
gen business_owner_manager = (occupation_cleaned == "business_owner_manager")*100  
replace business_owner_manager = . if audited != "yes" 
gen elected_pol = (elected_politician == "yes")*100  
replace elected_pol = . if audited != "yes" 

//Labels
la var white "White Borrower"
la var contractor_re_developer "Borrower is in Real Estate"
la var  business_owner_manager "Borrower is a Business Owner"
la var   elected_pol "Borrower is Elected Politician"
gen facevalue2=int(facevalue)


//Summary Statistics

//Borrowers Demographics - Volume weighted
estpost tabstat white washington contractor_re_developer business_owner_manager  elected_pol   issue_year maturity_months  percentdue manager_mapped    [fw=facevalue2], statistics(mean sd p25 p50 p75) columns(statistics)  

//Loan Characteristics
estpost tabstat facevalue, statistics(mean sd p25 p50 p75) columns(statistics)  
estpost tabstat issue_year maturity_months , statistics(mean sd p25 p50 p75) columns(statistics)  

//Insider Lending - Volume weighted
estpost tabstat   percentdue manager_mapped    [fw=facevalue2], statistics(mean sd p25 p50 p75) columns(statistics)  

